﻿using Shop.RemoteModel.Category;
using Shop.RemoteModel.Category.Model;
using Shop.StoreGatewayModular.Interface;

namespace Shop.StoreGatewayModular.Service
{
    internal class CategoryService : ICategoryService
    {
        public long Add (CategoryAdd datum)
        {
            return new AddCategory
            {
                Category = datum
            }.Send();
        }
        public CategoryDatum Get (long id)
        {
            return new GetCategory
            {
                Id = id
            }.Send();
        }
        public void Enable (long id)
        {
            new EnableCategory
            {
                Id = id
            }.Send();
        }
        public void Disable (long id)
        {
            new DisableCategory
            {
                Id = id
            }.Send();
        }
        public CategoryTree[] GetTree (CategoryGetParam param)
        {
            return new GetCategoryTree()
            {
                GetParam = param
            }.Send();
        }
        public CategoryFullTree[] GetFullTree ()
        {
            return new GetCategoryFullTree().Send();
        }
        public void Move (long id, long? toId)
        {
            new MoveCategory
            {
                Id = id,
                ToId = toId
            }.Send();
        }
        public Dictionary<long, int> SetSort (long id, int sort)
        {
            return new SetCategorySort
            {
                Id = id,
                Sort = sort
            }.Send();
        }
        public bool Set (long id, CategorySet set)
        {
            return new SetCategory
            {
                Id = id,
                Datum = set
            }.Send();
        }
        public void Delete (long id)
        {
            new DeleteCategory
            {
                Id = id
            }.Send();
        }
    }
}
